package cn.mw.cmdb.entity.instanceToPo;

import com.alibaba.fastjson.JSON;
import org.neo4j.driver.Value;
import org.neo4j.driver.Values;
import org.springframework.data.neo4j.core.convert.Neo4jPersistentPropertyConverter;

public class InstanceRelationDataConverter implements Neo4jPersistentPropertyConverter<InstanceRelationData> {

    @Override
    public Value write(InstanceRelationData source) {
        return Values.value(JSON.toJSONString(source));
    }

    @Override
    public InstanceRelationData read(Value source) {
        return JSON.parseObject(source.asString() ,InstanceRelationData.class);
    }
}
